package com.sky.BeanUtils;

import org.springframework.beans.BeanUtils;

import java.util.ArrayList;
import java.util.List;
import java.util.function.Supplier;

public class MyBeanUtils extends BeanUtils {

    public static <S,T> List<T> ListBeanUtils(List<S> start, Supplier<T> end){
        List<T> endList = new ArrayList<>(start.size());
        for (S s : start) {
            T t = end.get();
            BeanUtils.copyProperties(s,t);
            endList.add(t);
        }
        return endList;
    }
}
